package com.linln.modules.ticket.service;

import com.github.pagehelper.PageInfo;
import com.linln.common.vo.JsonResult;
import com.linln.common.vo.PageResult;
import com.linln.modules.system.domain.User;
import com.linln.modules.ticket.domain.Ticket;
import com.baomidou.mybatisplus.extension.service.IService;
import com.linln.modules.ticket.domain.TicketLog;
import org.springframework.web.multipart.MultipartFile;

import java.text.ParseException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author : pengliang
 * @version V1.0
 * @Project: timo
 * @Package com.linln.modeles.ticket.service
 * @Descriptio /**
 * @Project: timo
 * @Package com.linln.modeles.ticket.service
 * @Description: TODO
 * @date Date : 2020年11月23日 13:43
 */

public interface TicketService extends IService<Ticket> {
    //获取全部服务券数量
    Integer getAllTicketCount(long userId);

    //获取未使用服务券
    PageInfo<Ticket> getNotUseTicket(long userId, Integer pageNum, Integer limit);

    //获取已使用服务券
    PageInfo<Ticket> getUsedTicket(long userId, Integer pageNum, Integer limit);

    //获取已过期的服务券
    PageInfo<Ticket> getExpireTicket(long userId, Integer pageNum, Integer limit);

    //添加服务券
    boolean addTicket(Ticket ticket);

    //获取服务券信息
    Ticket getTicketInfo(String ticketId);

//    //通过券码核销
//    JsonResult ticketCodeVerification(long userId, String ticketCode, String car, String imgPath) throws ParseException;

    //通过券码核销
    JsonResult ticketCodeVerification(long userId, String ticketCode, String car, String imgPath,String shopId) throws ParseException;

    //爆粗核销图片
    Map<String, Object> saveVerificationImg(MultipartFile file);

    //通过base64保存核销图片
    Map<String, Object> saveVerificationImgByBase64(String file);

    //通过券id核销
//    JsonResult ticketIdVerification(long userId,String ticketId)throws ParseException;

    //获取核销历史
    Map<String, Object> getVerificationRecord(long userId, Integer pageNum, Integer limit, String date,String shopId);


//    boolean addBatch(List<Ticket> ticketList);

    //将超过有效期的券设为已过期
    boolean checkExpire();

    //赠送用户券
    Map<String,Object> registerUserAndSendTicket(User user);
    //获取核销历史
    PageResult<TicketLog> getTicketLogList(Integer pageNum, Integer limit, String shopId, String startDate, String endDate);

    //通过活动券赠送用户优惠券
    Map<String,Object> giveCanGiveActivity(long userId);
}
